/*
 * Regola grammaticale:
 * <factb> → NOT <factb>
 * 
 * Simboli terminali:
 * "not" o "!"
 */
package composite.boolean_expression.factb;

import composite.Component;
import composite.boolean_expression.Factb;
import visitor.Visitor;

/**
 *
 * @author Antonio
 */
public class FactbNot extends Factb {

    private Factb factb;

    public FactbNot(Factb factb) {

        if (factb == null) {

            throw new NullPointerException();
        }

        this.factb = factb;
    }

    public Factb getState() {

        return factb;
    }// getState

    @Override
    public void interpreta(String contesto) {

        factb.interpreta(contesto);
    }

    @Override
    public void accept(Visitor v) {

        v.visit(this);
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder();

        sb.append(" !").append(factb);

        return sb.toString();
    }

    @Override
    public void add(Component c) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
